#include "gtk/css/gtkcssparserprivate.h"
+#define _GDK_RGBA_DECODE(c) ((unsigned)(((c) >= 'A' && (c) <= 'F') ? ((c)-'A'+10) : \
+ ((c) >= 'a' && (c) <= 'f') ? ((c)-'a'+10) : \
+ ((c) >= '0' && (c) <= '9') ? ((c)-'0') : \
+ -1))
+#define _GDK_RGBA_SELECT_COLOR(_str, index3, index6) _GDK_RGBA_DECODE (sizeof(_str) <= 4 ? (_str)[index3] : (_str)[index6])
+#define GDK_RGBA(str) ((GdkRGBA) {\
+ ((_GDK_RGBA_SELECT_COLOR(str, 0, 0) << 4) | _GDK_RGBA_SELECT_COLOR(str, 0, 1)) / 255., \
+ ((_GDK_RGBA_SELECT_COLOR(str, 1, 2) << 4) | _GDK_RGBA_SELECT_COLOR(str, 1, 3)) / 255., \
+ ((_GDK_RGBA_SELECT_COLOR(str, 2, 4) << 4) | _GDK_RGBA_SELECT_COLOR(str, 2, 5)) / 255., \
+ ((sizeof(str) % 4 == 1) ? ((_GDK_RGBA_SELECT_COLOR(str, 3, 6) << 4) | _GDK_RGBA_SELECT_COLOR(str, 3, 7)) : 0xFF) / 255 })
+
gboolean gdk_rgba_parser_parse (GtkCssParser *parser,
GdkRGBA *rgba);
parse_color_node (GtkCssParser *parser)
{
graphene_rect_t bounds = GRAPHENE_RECT_INIT (0, 0, 0, 0);
- GdkRGBA color = { 0, 0, 0, 1 };
+ GdkRGBA color = GDK_RGBA("FF0000");
const Declaration declarations[] = {
{ "bounds", parse_rect, NULL, &bounds },
{ "color", parse_color, NULL, &color },
parse_inset_shadow_node (GtkCssParser *parser)
{
GskRoundedRect outline = GSK_ROUNDED_RECT_INIT (0, 0, 0, 0);
- GdkRGBA color = { 0, 0, 0, 1 };
+ GdkRGBA color = GDK_RGBA("000000");
double dx = 1, dy = 1, blur = 0, spread = 0;
const Declaration declarations[] = {
{ "outline", parse_rounded_rect, NULL, &outline },
{
GskRoundedRect outline = GSK_ROUNDED_RECT_INIT (0, 0, 0, 0);
float widths[4] = { 1, 1, 1, 1 };
- GdkRGBA colors[4] = { { 0, 0, 0, 1 }, {0, 0, 0, 1 }, {0, 0, 0, 1 }, { 0, 0, 0, 1 } };
+ GdkRGBA colors[4] = { GDK_RGBA("000"), GDK_RGBA("000"), GDK_RGBA("000"), GDK_RGBA("000") };
const Declaration declarations[] = {
{ "outline", parse_rounded_rect, NULL, &outline },
{ "widths", parse_float4, NULL, &widths },
parse_outset_shadow_node (GtkCssParser *parser)
{
GskRoundedRect outline = GSK_ROUNDED_RECT_INIT (0, 0, 0, 0);
- GdkRGBA color = { 0, 0, 0, 1 };
+ GdkRGBA color = GDK_RGBA("000000");
double dx = 1, dy = 1, blur = 0, spread = 0;
const Declaration declarations[] = {
{ "outline", parse_rounded_rect, NULL, &outline },
{
PangoFont *font = NULL;
graphene_point_t offset = GRAPHENE_POINT_INIT (0, 0);
- GdkRGBA color = { 0, 0, 0, 1 };
+ GdkRGBA color = GDK_RGBA("000000");
PangoGlyphString *glyphs = NULL;
const Declaration declarations[] = {
{ "font", parse_font, clear_font, &font },